import request from '@/utils/request'
// 夜间活动设置 API接口
// eslint-disable-next-line camelcase
const crw_rule_zoneout_Api = {
  list: '/crw_rule_zoneout/list', // 禁出圈设置分页列表
  view: '/crw_rule_zoneout/view', // 查看禁出圈设置
  delete: '/crw_rule_zoneout/delete', // 删除禁出圈设置
  save: '/crw_rule_zoneout/save', // 修改或保存禁出圈设置
  saveRule: '/crw_rule_zoneout/saveRule', // 修改或保存禁出圈设置及人员，人员分组信息
  existsRuleName: '/crw_rule_zoneout/existsRuleName' // 判断规则名称是否已存在
}

/**
 * 禁出圈设置分页列表接口
 * @param body
 */
export function zoneoutRuleList (body) {
  return request({
    url: crw_rule_zoneout_Api.list,
    method: 'post',
    data: body
  })
}

/**
 * 禁出圈设置分页列表接口
 * @param id
 */
export function viewZoneoutRule (id) {
  return request({
    url: crw_rule_zoneout_Api.view,
    method: 'get',
    params: {
      id
    }
  })
}

/**
 * 禁出圈设置分页列表接口
 * @param id
 */
export function deleteZoneoutRule (id) {
  return request({
    url: crw_rule_zoneout_Api.delete,
    method: 'post',
    params: {
      id
    }
  })
}

/**
 * 禁出圈设置分页列表接口
 * @param body
 */
export function saveZoneoutRule (body) {
  return request({
    url: crw_rule_zoneout_Api.save,
    method: 'post',
    data: body
  })
}

/**
 * 修改或保存禁出圈设置及人员，人员分组信息
 * @param body
 * @param personIds
 * @param groupIds
 * @param geopointIds
 */
export function saveRuleSetting (body, personIds, groupIds, geopointIds) {
  return request({
    url: crw_rule_zoneout_Api.saveRule,
    method: 'post',
    data: body,
    params: {
      personIds,
      groupIds,
      geopointIds
    }
  })
}

/**
 * 判断地图描述是否已存在
 * @param name
 */
export function existsRuleName (name) {
  return request({
    url: crw_rule_zoneout_Api.existsRuleName,
    method: 'get',
    params: {
      name
    }
  })
}
